import time

is_loign = False


def login():
    username = input("输入用户名:")
    password = input("输入密码:")

    if username == "root" and password == "123456":
        return True

    return False


def login_required(func):
    def wrapper(*args, **kwargs):
        global is_loign
        print("------付款-----")
        if is_loign:
            func(*args)
            print("开始付款")
            time.sleep(2)
            print("付款成功")
        else:
            print("跳转到登录")
            is_loign = login()
            print("result : ", is_loign)

    return wrapper


@login_required
def pay(money):
    print("付款{}元".format(money))


pay(10000)
pay(8000)
